package com.bootdo.appsystem.service.impl;

import com.bootdo.appsystem.domain.OrderproductitemsDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.bootdo.appsystem.dao.EvaluateDao;
import com.bootdo.appsystem.domain.EvaluateDO;
import com.bootdo.appsystem.service.EvaluateService;



@Service
public class EvaluateServiceImpl implements EvaluateService {
	@Autowired
	private EvaluateDao evaluateDao;
	
	@Override
	public EvaluateDO get(Integer eid){
		return evaluateDao.get(eid);
	}
	
	@Override
	public List<EvaluateDO> list(Map<String, Object> map){
		return evaluateDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return evaluateDao.count(map);
	}
	
	@Override
	public int save(EvaluateDO evaluate){
		return evaluateDao.save(evaluate);
	}
	
	@Override
	public int update(EvaluateDO evaluate){
		return evaluateDao.update(evaluate);
	}
	
	@Override
	public int remove(Integer eid){
		return evaluateDao.remove(eid);
	}
	
	@Override
	public int batchRemove(Integer[] eids){
		return evaluateDao.batchRemove(eids);
	}

	@Override
	public EvaluateDO getEvaluateByOrderProductitem(OrderproductitemsDO orderproductitemsDO , Integer uid) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("pid" , orderproductitemsDO.getPid());
        map.put("uid" , uid);
        map.put("ordercode" , orderproductitemsDO.getOid());
        List<EvaluateDO> list = this.list(map);
        if(list.size() > 0){
            return list.get(0);
        }
        return null;
	}

}
